UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Efr5shYhCfUpop9wq511EGfPvjWtUPzjeFWrBKt7KZg=' 
WHERE 
  key_id = '7500b3d1659fec526d88d7209a6b369dc07b3c7ecbe24b3007a598ef2c834d29' 
  AND (
    token = 'Efr5shYhCfUpop9wq511EGfPvjWtUPzjeFWrBKt7KZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044