UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FL+HK3tAnjAKJTxdWnw47uK+8P7dVlLTfknXs33MEQE=' 
WHERE 
  key_id = 'be5cfa6264d163c14996dd6363c6b2b92a90d74605f363c8206e0ccce4e82750' 
  AND (
    token = 'FL+HK3tAnjAKJTxdWnw47uK+8P7dVlLTfknXs33MEQE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049