UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z62LHT/FehZM8ia8pxlS6MeCxET2aTYZJy/EGcr+bNw=' 
WHERE 
  key_id = 'd606ee07551190446b7fe5ca9da6f03a90f8b17d9386520a03e989595d4fe6a7' 
  AND (
    token = 'Z62LHT/FehZM8ia8pxlS6MeCxET2aTYZJy/EGcr+bNw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032