UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F0CS8Ao7mkFGKmq4eC059/z2Yts+hzToVot74MAyF3Q=' 
WHERE 
  key_id = '0c8d02cd402d5552a8ef3e0cafd0ff32af0b38fa9608cd8b918de315067b65cf' 
  AND (
    token = 'F0CS8Ao7mkFGKmq4eC059/z2Yts+hzToVot74MAyF3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037