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

Query time 0.00038