UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eOxjMDPSnbw2pnTXcpstYbvXmDomc82u0ZmytwLcUAM=' 
WHERE 
  key_id = 'c50bbb292837a649060ae797f5f0d2d6af60f71d989be1457fbd864aa985f54e' 
  AND (
    token = 'eOxjMDPSnbw2pnTXcpstYbvXmDomc82u0ZmytwLcUAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038