UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3DZWBfWQB6EZYLh3Kgmnvg3JXZeBRelfcQPCzXfVpIk=' 
WHERE 
  key_id = 'ca8e5b7af2dbaf479ebe94595bf0897482612235f2c5b47a03560c1a7e0cb90e' 
  AND (
    token = '3DZWBfWQB6EZYLh3Kgmnvg3JXZeBRelfcQPCzXfVpIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043