UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sgrPNHLTQ6dof9zMAHnf+cgRLgFZSfTI/exUR5OBPh4=' 
WHERE 
  key_id = '2a7c07e91b035d95786e493388abf67c89701a2b260df8e91a9dc5f2b1ad7c7f' 
  AND (
    token = 'sgrPNHLTQ6dof9zMAHnf+cgRLgFZSfTI/exUR5OBPh4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034