UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U30TulXdMsz91QSHDjUavikBpYwO/uKOhX06XR/v3pY=' 
WHERE 
  key_id = '9816d1f05d3743cd795c89d1bc85a78b3492cdda237cfe219f4267acaa2df2b9' 
  AND (
    token = 'U30TulXdMsz91QSHDjUavikBpYwO/uKOhX06XR/v3pY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028