UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XpI7uMph+Jn41xOtkute8JqKCiO1w8BsPhAQPDtlVQA=' 
WHERE 
  key_id = '945483d527ba183a346b98dbaca67953b2920050c0040d439c62b1b8cad342eb' 
  AND (
    token = 'XpI7uMph+Jn41xOtkute8JqKCiO1w8BsPhAQPDtlVQA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041