UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kyAQjXDpx6JnKbud9XsUiFj+IHmxz2Yuw2yZh8Zdphc=' 
WHERE 
  key_id = '748ba4db75fc3f2c56897dec5c5d0feadbd350dc98157143f2d071485fa2b90f' 
  AND (
    token = 'kyAQjXDpx6JnKbud9XsUiFj+IHmxz2Yuw2yZh8Zdphc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030