UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CpGskdaXlSbPPOwY6VL8GK/ouw8Fcz4wc2sghVdLSZQ=' 
WHERE 
  key_id = '1022ee2b0bcb9fae51ce6b12a22511f7ccedafa7e7e8cd2d915df9d3dc323086' 
  AND (
    token = 'CpGskdaXlSbPPOwY6VL8GK/ouw8Fcz4wc2sghVdLSZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034