UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RnTiMADpvb7mjsnOr0BKvGVWlC1TIUT84oFo3PGqPIo=' 
WHERE 
  key_id = '982c173c48e267e47da721de49ae4150b54e3e354c21a5e4b1a121aa5a9ac875' 
  AND (
    token = 'RnTiMADpvb7mjsnOr0BKvGVWlC1TIUT84oFo3PGqPIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026