UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NojhB1oyFI1GMe4BGiv6WhIQIIoZGuNZ9ApsjVQemx8=' 
WHERE 
  key_id = '86b11d8b156d52e37898af6a260074aad7f6a21d3786eb3a9699eeb5fa56796e' 
  AND (
    token = 'NojhB1oyFI1GMe4BGiv6WhIQIIoZGuNZ9ApsjVQemx8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017