UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yQqMn7A9t2BGYGZ5MndC2gaPu6WjkXBH6YKD23vB8qU=' 
WHERE 
  key_id = '0886760b9a5eb768dbc70a1d85bccec6d77beea9a315a44b211770a5da47829e' 
  AND (
    token = 'yQqMn7A9t2BGYGZ5MndC2gaPu6WjkXBH6YKD23vB8qU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032