UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UhwC6/NGVbMZcgxR7C0UsM4zZOjp6j0OLvDcyRgE6Q8=' 
WHERE 
  key_id = 'eaa16b30bba85d1435eef8b2c2dd32a3be576b739780e36966abc5fdc6ec8c97' 
  AND (
    token = 'UhwC6/NGVbMZcgxR7C0UsM4zZOjp6j0OLvDcyRgE6Q8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034