UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6DTtBBuKY7K+gvufyvL+lf9CMRUkYdmdaXYrivnavK8=' 
WHERE 
  key_id = 'f3b6b89875412fc68eccf1502d2f46791e9ab3cee4b2ef11b5162d92c2185532' 
  AND (
    token = '6DTtBBuKY7K+gvufyvL+lf9CMRUkYdmdaXYrivnavK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042