UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7bK9I0ShjAqhOpSz/zVwG0z2RcD2nACDqs4ZDHwhDr0=' 
WHERE 
  key_id = 'd9b644e20a3411cbd860b720d83bf1762827aa30340217764ee880435fa01e1c' 
  AND (
    token = '7bK9I0ShjAqhOpSz/zVwG0z2RcD2nACDqs4ZDHwhDr0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052