UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+odycNs7KENJ+Ifga7Qc5tMK691n3lVt1DHufrKoSNA=' 
WHERE 
  key_id = 'ba0f356cdeae26f65eddc1752aff6371798ec8aa9de58e02040d3c6a751c04b1' 
  AND (
    token = '+odycNs7KENJ+Ifga7Qc5tMK691n3lVt1DHufrKoSNA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041