UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CwohQUqMTtLpFe6V1SjuRxBNDDxids4msOBwKrSxmao=' 
WHERE 
  key_id = '6bae2b6bed41ddcd67a7f082a8c294619a0faaae8987f63969ff57f33c224ba5' 
  AND (
    token = 'CwohQUqMTtLpFe6V1SjuRxBNDDxids4msOBwKrSxmao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021