UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pjr+2bMhwzgmf+riCfYeWJqgmhedJd7Cks54OoMo1fs=' 
WHERE 
  key_id = 'ac0ddc9b5a13a627de96e6df1fb43855e9fa85834b0161c03cb401c4b5418872' 
  AND (
    token = 'pjr+2bMhwzgmf+riCfYeWJqgmhedJd7Cks54OoMo1fs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018