UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jccr721nZt0WybWUk+1JZcgAQaoy0ITJx6ZGt2HtYUk=' 
WHERE 
  key_id = '513d8e83e9477ebbb85a28d7ed6e4383d7adab9d79da8ff2084c0f3717a80649' 
  AND (
    token = 'jccr721nZt0WybWUk+1JZcgAQaoy0ITJx6ZGt2HtYUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037