UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tGFv7h/JdXM9kRUSCezU5nq0a5aj1ZIvxwzkVZxMTwg=' 
WHERE 
  key_id = '4818c0ec0825904b1ba6f3db314399608dd264627798ed6e731ff6149f3f7621' 
  AND (
    token = 'tGFv7h/JdXM9kRUSCezU5nq0a5aj1ZIvxwzkVZxMTwg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032