UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tn2n5si0eIc374/d5hT7+lgcnwpNJ7694IBp3DOf8VE=' 
WHERE 
  key_id = '0876a6c0d40bd9288d6e9414a6bc638659d572817925038db95d6a0777328924' 
  AND (
    token = 'tn2n5si0eIc374/d5hT7+lgcnwpNJ7694IBp3DOf8VE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037