UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rGfuymyWU7bZCRRP5C63E/D1mHqxf616IDx2yhhlQkA=' 
WHERE 
  key_id = '04ebc96cb14700df7a8eb9d2f92aaf185bf0d669f97bcfc3eea1e26f9a33c374' 
  AND (
    token = 'rGfuymyWU7bZCRRP5C63E/D1mHqxf616IDx2yhhlQkA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027