UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e/HNOMUNl7PmsMaVFB4w5TRco+mSJQqfLTF/3XYgLeM=' 
WHERE 
  key_id = 'a39feadde8b27d8501eb7651b0e8dcf902d3e668dccff7b5dbe2710482ca5e01' 
  AND (
    token = 'e/HNOMUNl7PmsMaVFB4w5TRco+mSJQqfLTF/3XYgLeM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034