UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pYr4PkHxbrkC3aIweNm7ZfXBIwzbCQd6XE85Vux9VwY=' 
WHERE 
  key_id = '12876592ba881f2c2284b2b8ec27e295fa8dfe7c0964bbe2b12caa542a8eaab9' 
  AND (
    token = 'pYr4PkHxbrkC3aIweNm7ZfXBIwzbCQd6XE85Vux9VwY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030