UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JnN2h/asez1+QHszNvOg1yDME5wRBObEs4JSnjm/6hM=' 
WHERE 
  key_id = '87fe944f4142b8c81d01bfbb52b9894ebaa4b907c2a426039e1e7179ef9a0dd6' 
  AND (
    token = 'JnN2h/asez1+QHszNvOg1yDME5wRBObEs4JSnjm/6hM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00094