UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JPbIaj4ipcWAZzCYafybbc69g5IJOvBRTpQBspukQlA=' 
WHERE 
  key_id = '01ccf35a67f4f1a74d8898f1781ae1ba6693b4e6b89b9530bd2a181ce4bf0e2e' 
  AND (
    token = 'JPbIaj4ipcWAZzCYafybbc69g5IJOvBRTpQBspukQlA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071