UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'affwHzYm0eikHQPG+QLk5F7TVI/BkWpi9K3wnNvaTAg=' 
WHERE 
  key_id = 'be5da7921386eaa6cae633df426f3586c50d6ef7b22a0f98a6c22ca7a8129470' 
  AND (
    token = 'affwHzYm0eikHQPG+QLk5F7TVI/BkWpi9K3wnNvaTAg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028