UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6aYsI/Gyj3K794KpyC4W82EznOcLcOKNEozMroRJ2nk=' 
WHERE 
  key_id = 'f7c320bd46afc4f60b9164b9312356d66853492cbc97a240c4310e9015e7d428' 
  AND (
    token = '6aYsI/Gyj3K794KpyC4W82EznOcLcOKNEozMroRJ2nk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063