UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WPgw4iKpov201kXE19LZ+PpOCkR43GX0OP+vAGrppFQ=' 
WHERE 
  key_id = '18ca63a186c321fe2c8729d776fc54c8a4b9cb2fc7f57917a627826a757f5f3c' 
  AND (
    token = 'WPgw4iKpov201kXE19LZ+PpOCkR43GX0OP+vAGrppFQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025